package com.ruoyi.system.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.vo.EmployeeAssessDetailVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/jixiao/plan/assessmentProgress/detail/personDetail")
public class EmployeeAssessmentDetailController extends BaseController {
    @Autowired
    private com.ruoyi.system.service.IEmployeeAssessmentDetailService employeeAssessmentDetailService;

    //1展示页面
    @GetMapping("/getDetailVOList")
    public EmployeeAssessDetailVO list(@Param("employeeId") int employeeId){
        //业务逻辑
        EmployeeAssessDetailVO employeeAssessDetailVO = employeeAssessmentDetailService.getEmployeeAssessDetailVO(employeeId);
        return employeeAssessDetailVO;
    }

    //2添加分数
    @PutMapping("/addScore")
    public AjaxResult addScore( int employeeId, int indicatorsId, String score){
        //业务逻辑
        int i = employeeAssessmentDetailService.addEmployeeAssessmentDetail(employeeId, indicatorsId, score);
        if(i>0){
            return success(i);
        } else {
            return error("操作失败");
        }
    }

    //3根据员工id修改状态
    @PutMapping("/updateStatus")
    public AjaxResult updateStatus( int employeeId, String status){
        //业务逻辑
        int i = employeeAssessmentDetailService.updateEmployeeAssessmentDetail(employeeId, status);
        if(i>0){
            return success(i);
        } else {
            return error("操作失败");
        }
    }
    //4根据员工id修改最终分数
    @PutMapping("/updateFinalScore")
    public AjaxResult updateFinalScore( int employeeId, Double finalScore){
        //业务逻辑
        int i = employeeAssessmentDetailService.updateEmployeeAssessmentDetailFinalScore(employeeId, finalScore);
        if(i>0){
            return success(i);
        } else {
            return error("操作失败");
        }
    }
}
